#ifndef __M_CONSUMER_H__
#define __M_CONSUMER_H__
#include "../mqcommon/helper.hpp"
#include "../mqcommon/log.hpp"
#include "../mqcommon/mq_meg.pb.h"

#include <iostream>

namespace pprmq
{
    // 回调函数的作用:解耦消息接收与消息处理逻辑
    using ConsumerCallback = std::function<void(const std::string, const BasicProperties *bp, const std::string)>;
    class Consumer
    {
    public:
        Consumer() {}
        Consumer(std::string ctag, std::string queue_qname, bool auto_ack, ConsumerCallback cb)
            : _tag(ctag), _qname(queue_qname), _auto_ack(auto_ack), _callback(cb)
        {}

    public:
        using ptr = std::shared_ptr<Consumer>;
        std::string _tag;   // 消费者的标识
        std::string _qname; // 消费者订阅的队列
        bool _auto_ack;     // 自动确认状态
        ConsumerCallback _callback;
    };    
}

#endif